package com.spzx.user.api.service;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserInfo;
import com.spzx.user.api.factory.RemoteUserInfoFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteUserInfoService",value = ServiceNameConstants.USER_SERVICE,fallbackFactory = RemoteUserInfoFallbackFactory.class)
public interface RemoteUserInfoService {


    @Operation(summary = "供微服务内部远程调用用户注册的接口")
    @PostMapping("/userInfo/register")
    public R<Boolean> register(@RequestBody UserInfo userInfo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @Operation(summary = "供微服务内部远程调用,根据用户名获取用户信息")
    @GetMapping("/userInfo/getUserInfoByUsername/{username}")
    public R<UserInfo> getUserInfoByUsername(@PathVariable("username") String username,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @Operation(summary = "供微服务内部远程调用,更新用户登录信息")
    @PutMapping("/userInfo/updateUserLogin")
    public R<Boolean> updateUserLogin(@RequestBody UpdateUserLogin updateUserLogin,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
